package com.education.user.mapper;

import com.education.user.pojo.SysEdition;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;


/**
 * APP版本 数据层
 *
 * @author d
 * @date 2020-05-28
 */
@Repository
public interface SysEditionMapper extends Mapper<SysEdition> {

    @Select({
            "<script>",
            "  select id, remark, version, package_url packageUrl , package_type packageType , upgrade_type upgradeType , create_time createTime ," +
                    "endpoint endpoint from sys_edition",
            "</script>"
    })
    List<SysEdition> selectOther(SysEdition sysEdition);

    @Select({
            "<script>",
            "  select id, remark, version, package_url packageUrl , package_type packageType , upgrade_type upgradeType , create_time createTime ,code code " +
                    "from sys_edition " +
                    "where package_type = 1 " +
                    "and endpoint = #{endpoint}",
            "order by create_time desc",
            "</script>"
    })
    List<SysEdition> selectOtherBytime(@Param("endpoint") Integer endpoint);

}